#include "comm.hpp"

int main()
{
    key_t key = getftok();

    int msqid = get_msqid(key);

    while (true)
    {
        char buf[Size];
        cout << "please enter: ";
        int n = read(0, buf, sizeof buf);
        if (n < 0)
        {
            cerr << "client read error! eoorr:" << errno << " strerror:" << strerror(errno) << endl;
            exit(1);
        }
        //read 将\n 进行读取,并且计算在返回值内
        buf[n-1]=0;  //这一步是去除 \n

        send_msg(msqid,servers_type,buf);

    }
}